package cn.toutatis.common.config;

/**
 * @author Toutatis_Gc
 * 响应结果的值
 */

public enum ResultCode {

    /**
     * 操作部分
     */
    NORMAL_SUCCESS("000000","000000",true,"请求成功","正常操作"),
    UPDATE_SUCCESS("000000","000001",true,"更新成功","正常操作"),
    INSERT_SUCCESS("000000","000006",true,"添加成功","正常操作"),
    DELETE_SUCCESS("000000","000002",true,"删除成功","正常操作"),
    APPLY_SUCCESS("000000","000005",true,"审核成功","正常操作"),
    REQUEST_SUCCESS("000001","000003",true,"发送请求成功","向第三方发送请求"),
    NORMAL_SUCCESS_BUT_NULL("000000","000004",true,"请求成功[空数据]","请求成功但为空数据"),

    NORMAL_FAILED("100000","100000",false,"操作失败","操作失败"),
    UPDATE_FAILED("100000","100001",false,"更新失败","操作失败"),
    INSERT_FAILED("100000","100005",false,"添加失败","操作失败"),
    DELETE_FAILED("100000","100002",false,"删除失败","操作失败"),
    APPLY_FAILED("100000","100004",false,"审核失败","操作失败"),
    REQUEST_FAILED("100001","100003",false,"发送请求失败","向第三方发送请求失败"),
    NOT_HAVE_SELECT_DATA("100002","100006",false,"数据为空","必要表单数据为空"),


    /**
     * 权限部分
     */
    ANONYMITY_FAILED("900000","900000",false,"拒绝匿名访问","匿名无权限访问"),
    CHECKED_FAILED("900001","900001",false,"校验失败","TOKEN或验证失败"),
    PERMISSION_DEFINED_FAILED("900002","900002",false,"权限不足","已认证权限不足"),

    /**
     * 系统部分
     */

    UNKNOWN_EXCEPTION("-1","-1",false,"未知请求","未知请求"),
    NULL_DIRECT_CODE("404001","404001",false,"未指定类型","没有指定MESSAGE"),
    MISSING_PARAMETER("404002","404002",false,"缺少参数","缺少参数"),
    NOT_FOUND("404000","404000",false,"请求未找到","请求未找到"),
    REQUEST_EXCEPTION("500000","500000",false,"发生错误","请求异常"),
    INNER_EXCEPTION("500001","500001",false,"内部错误","内部运行发生错误"),
    ILLEGAL_OPERATION("901000","901000",false,"非法请求[行为已记录]","越权操作"),
    NOT_ALLOW_REQUEST_METHOD("405000","405000",false,"不允许此方法访问","仅允许[POST,GET]"),
    ;

    private String code;
    private String innerCode;
    private String info;
    private String extraInfo;
    private boolean isSuccess;

    ResultCode(String code,String innerCode,boolean isSuccess,String info,String extraInfo) {
        this.code = code;
        this.innerCode = innerCode;
        this.info = info;
        this.extraInfo = extraInfo;
        this.isSuccess = isSuccess;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getExtraInfo() {
        return extraInfo;
    }

    public void setExtraInfo(String extraInfo) {
        this.extraInfo = extraInfo;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean success) {
        isSuccess = success;
    }
}
